//
//  LanguageViewController.m
//  ShareAnyWhere
//
//  Created by admin on 1/31/13.
//  Copyright (c) 2013 linh.nguyen. All rights reserved.
//

#import "LanguageViewController.h"

@interface LanguageViewController ()

@end

@implementation LanguageViewController
@synthesize lblHello;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSString *value = [[NSUserDefaults standardUserDefaults] objectForKey:@"langID"];
    NSLog(@"%@", value);
    lblHello.text = NSLocalizedString(@"welcome", Nil);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)choseVietnameseLang {
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    NSString *tmpLang = @"vi"; // en-US ?
    [prefs setObject:[NSArray arrayWithObjects:tmpLang, nil] forKey:@"AppleLanguages"];
    [prefs setObject:[NSString stringWithFormat:@"%d",2] forKey:@"langId"];
    [prefs synchronize];
}

- (IBAction)choseEnglishLang {
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    NSString *tmpLang = @"en"; // en-US ?
    [prefs setObject:[NSArray arrayWithObjects:tmpLang, nil] forKey:@"AppleLanguages"];
    [prefs setObject:[NSString stringWithFormat:@"%d",1] forKey:@"langId"];
    [prefs synchronize];
}
@end
